const {createProxyMiddleware : proxy} = require('http-proxy-middleware');
module.exports=function(app){
    app.use(
        proxy([process.env.REACT_APP_API],{//遇见/api前缀的请求,就会触发该代理配置
            target:'http://127.0.0.1:8080',//请求转发给谁
            changeOrigin:true,//控制服务器收到的请求头中的Host的值
            pathRewrite: {[`^${process.env.REACT_APP_API}`]:''}//重写请求路径
        }),
        proxy([process.env.REACT_APP_API2],{
            target:'http://10.138.100.154:8080/api/user',
            changeOrigin:true,
            pathRewrite: {[`^${process.env.REACT_APP_API2}`]:''}
        }),
    )
}